﻿#region Imports
using System;
using System.Globalization;
using System.Windows.Data;
#endregion

namespace DirectoryAnalyzer.Controls.Converters
{
    public class PercentageConverter : IValueConverter
    {
        #region Converter Methods
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double progress = System.Convert.ToDouble(value);
            progress = Math.Round(progress, 1);
            string percentValue = System.Convert.ToString(progress, culture);

            return percentValue + "%";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        } 
        #endregion
    }
}
